// 完成订单
const cloud = require('wx-server-sdk');
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();
exports.main = async (event, context) => {
  if (!event.openId) {
    return {
      msg: "缺少openId",
      code: 500
    }
  }
  const res = await db.collection('userOrders').doc(event.id).update({
    data:{
      success:"1",
      endTime:event.inTime
    }
  })
  return {
    code:200,
    ...res
  }
}